"use strict";
const common_vendor = require("../../../common/vendor.js");
const common_assets = require("../../../common/assets.js");
const api_police_index = require("../../../api/police/index.js");
const utils_tools = require("../../../utils/tools.js");
const config_app = require("../../../config/app.js");
const stores_userInfo = require("../../../stores/userInfo.js");
if (!Array) {
  const _easycom_up_gap2 = common_vendor.resolveComponent("up-gap");
  const _easycom_up_avatar2 = common_vendor.resolveComponent("up-avatar");
  const _easycom_personalModule2 = common_vendor.resolveComponent("personalModule");
  const _easycom_up_list_item2 = common_vendor.resolveComponent("up-list-item");
  const _easycom_up_list2 = common_vendor.resolveComponent("up-list");
  const _easycom_up_toast2 = common_vendor.resolveComponent("up-toast");
  (_easycom_up_gap2 + _easycom_up_avatar2 + _easycom_personalModule2 + _easycom_up_list_item2 + _easycom_up_list2 + _easycom_up_toast2)();
}
const _easycom_up_gap = () => "../../../node-modules/uview-plus/components/u-gap/u-gap.js";
const _easycom_up_avatar = () => "../../../node-modules/uview-plus/components/u-avatar/u-avatar.js";
const _easycom_personalModule = () => "../../../components/personalModule/personalModule.js";
const _easycom_up_list_item = () => "../../../node-modules/uview-plus/components/u-list-item/u-list-item.js";
const _easycom_up_list = () => "../../../node-modules/uview-plus/components/u-list/u-list.js";
const _easycom_up_toast = () => "../../../node-modules/uview-plus/components/u-toast/u-toast.js";
if (!Math) {
  (_easycom_up_gap + _easycom_up_avatar + _easycom_personalModule + _easycom_up_list_item + _easycom_up_list + _easycom_up_toast)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    const userInfoStore = stores_userInfo.useUserInfoStore();
    const uToastRef = common_vendor.ref(null);
    const list = common_vendor.ref([]);
    common_vendor.onLoad(() => {
      getCommunityPolices();
    });
    const scrolltolower = () => {
      loadmore();
    };
    const loadmore = () => {
      console.log("加载更多");
    };
    const navPosition = (poiInfo) => {
      common_vendor.index.openLocation({
        latitude: poiInfo.lat,
        longitude: poiInfo.lnt,
        scale: 18,
        name: poiInfo.communityName,
        address: poiInfo.communitAddress,
        success: function() {
          console.log("success");
        },
        fail: function(err) {
          console.log(err);
        }
      });
    };
    const getCommunityPolices = () => {
      common_vendor.index.showLoading({
        title: "加载中",
        mask: true
      });
      api_police_index.selectIndexPoliceUser({ communityId: userInfoStore.crowdInfo.communityId }).then((res) => {
        common_vendor.index.hideLoading();
        const { data } = res;
        list.value = data ?? [];
      }).catch((err) => {
        common_vendor.index.hideLoading();
        uToastRef.value.show({
          type: "error",
          message: err
        });
      });
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.f(common_vendor.unref(list), (item, index, i0) => {
          return common_vendor.e({
            a: "59483306-2-" + i0 + "," + ("59483306-1-" + i0),
            b: "59483306-4-" + i0 + "," + ("59483306-3-" + i0),
            c: common_vendor.p({
              src: common_vendor.unref(config_app.imgPrefix) + item.avatar,
              shape: "circle",
              size: "50"
            }),
            d: common_vendor.t(item.communityName + "民警"),
            e: common_vendor.t(item.userName),
            f: common_vendor.t(item.badgeNumber),
            g: common_vendor.t(item.phonenumber),
            h: common_vendor.o(($event) => common_vendor.unref(utils_tools.callPhone)(item.phonenumber), index),
            i: common_vendor.t(item.communitAddress),
            j: common_vendor.o(($event) => navPosition(item), index),
            k: "59483306-3-" + i0 + "," + ("59483306-1-" + i0),
            l: common_vendor.p({
              height: 222,
              leftWidth: 170,
              contentStyle: {
                padding: "24rpx"
              },
              showStatus: item.dutyStatus != 3 ? true : false,
              showGapLine: true,
              statusName: item.dutyStatus != 3 ? "在岗" : "",
              statusBgColor: "#33A954"
            }),
            m: index + 1 == common_vendor.unref(list).length
          }, index + 1 == common_vendor.unref(list).length ? {
            n: "59483306-5-" + i0 + "," + ("59483306-1-" + i0),
            o: common_vendor.p({
              height: "10"
            })
          } : {}, {
            p: index,
            q: "59483306-1-" + i0 + ",59483306-0"
          });
        }),
        b: common_vendor.p({
          height: "10"
        }),
        c: common_vendor.unref(common_assets.locationIcon),
        d: common_vendor.o(scrolltolower),
        e: common_vendor.p({
          height: "100vh"
        }),
        f: common_vendor.sr(uToastRef, "59483306-6", {
          "k": "uToastRef"
        })
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-59483306"]]);
wx.createPage(MiniProgramPage);
